covid19brazil

build CRAN_Status_Badge lifecycle License: Mit Github commit

The covid19brazil R package has daily information on the number of accumulated cases and accumulated deaths for the COVID-19 pandemic in Brazil. The information available in the package is organized as follows:

Installation

To install the package, one of the two standard methods for installing packagesin R can be adopted. Directly through the cran (choosing the closest repository):

install.packages ("covid19brazil")

Or even using the command below. In the latter case, the latest version of the package will be installed.

# install.packages ("devtools")
devtools::install_github ("AlexandreLoures/covid19brazil")

The update_data command

To obtain the most up-to-date version of the data on the new coronavirus (COVID-19) pandemic in Brazil, use the update_data command. Data is updated daily on Github (Dev) version, however, the CRAN version of the covid19brazil package is updated every month or two. Don’t forget to restart the R session to load the new data.

update_data ()

Using the package

data ("brazil_total")

head (brazil_total)
#   region       date epidWeek population accumCases newCases accumDeaths
# 1 Brasil 2020-02-25        9  210147125          0        0           0
# 2 Brasil 2020-02-26        9  210147125          1        1           0
# 3 Brasil 2020-02-27        9  210147125          1        0           0
# 4 Brasil 2020-02-28        9  210147125          1        0           0
# 5 Brasil 2020-02-29        9  210147125          2        1           0
# 6 Brasil 2020-03-01       10  210147125          2        0           0
#   newDeaths newRecov followUp
# 1         0        0        0
# 2         0        1        0
# 3         0        1        0
# 4         0        0        1
# 5         0        1        1
# 6         0        1        1

Download, read and analyze the microdata

Cases accumulated per 100,000 inhabitants

The graph below shows the number of cases accumulated in each Federative Unit of Brazil per 100,000 inhabitants (data for the day 2022-07-30).

Data source: Ministerio da Saude - Sistema Unico de Saude (SUS)

 

Below is the graph for the number of cases accumulated per 100,000 inhabitants for each of the five macro-regions in Brazil.

Deaths accumulated per 100,000 inhabitants

In turn, the next graph shows the number of deaths accumulated in each Federative Unit of Brazil per 100,000 inhabitants (data for the day 2022-07-30).

Data source: Ministerio da Saude - Sistema Unico de Saude (SUS)

 

The graph below shows the number of accumulated deaths per 100,000 inhabitants for each of Brazil’s five macro-regions.

Moving averages and forecast

library (ploty)

plot_ly(data = brazil_total,
        x = ~ date,
        y = ~home_confinement, 
        name = 'Home Confinement', 
        fillcolor = '#FDBBBC',
        type = 'scatter',
        mode = 'none', 
        stackgroup = 'one') %>%
  add_trace( y = ~ hospitalized_with_symptoms, 
             name = "Hospitalized with Symptoms",
             fillcolor = '#E41317') %>%
  add_trace(y = ~intensive_care, 
                name = 'Intensive Care', 
                fillcolor = '#9E0003') %>%
  layout(title = "Number of cases accumulated by region",
         legend = list(x = 0.8, y = 0.9),
         yaxis = list(title = "Number of Cases"),
         xaxis = list(title = "Source: Ministerio da Saude (Sistema Unico de Saude"))
p <- plot_ly(data = brazil_total,
        x = ~ date,
        y = ~home_confinement, 
        name = 'Home Confinement', 
        fillcolor = '#FDBBBC',
        type = 'scatter',
        mode = 'none', 
        stackgroup = 'one') %>%
  add_trace( y = ~ hospitalized_with_symptoms, 
             name = "Hospitalized with Symptoms",
             fillcolor = '#E41317') %>%
  add_trace(y = ~intensive_care, 
                name = 'Intensive Care', 
                fillcolor = '#9E0003') %>%
  layout(title = "Number of deaths accumulated by region",
         legend = list(x = 0.8, y = 0.9),
         yaxis = list(title = "Number of Deaths"),
         xaxis = list(title = "Source: Ministerio da Saude (Sistema Unico de Saude"))